<?php
namespace Admin\Controller;
// 后台账户中心模块
class AccountController extends CommonController {
	
	public function cardlist()
	{
		$role = D("Account");
		var_dump($role);
		$this->display();
	}
	/*发送短信*/
	public function sendinfo()
    {

        $curre_user_id = $_SESSION['zs_admin']['userid'];
        if ($curre_user_id == 1) {
            // $map['user_id'] = $curre_user_id;
        }else{
            $map['user_id'] = $curre_user_id;
        }
        $count = M('fa_sms')->where($map)->count();
        $p = new \Think\Page($count, $listRows);
        //分页查询数据
        $numPerPage = empty($_REQUEST['numPerPage']) ? C('PAGE_LISTROWS') : $_REQUEST['numPerPage'];
        
        $SendList = M('fa_sms')->where($map)->order('fa_id desc')->limit($numPerPage)->page($_REQUEST[C('VAR_PAGE')])->select();
        foreach ($SendList as $key => $val) {
            $SendList[$key]['user_name'] = M('user')->where(array('id'=>$val['user_id']))->getField('nickname');
        }

        //分页显示
        $page = $p->show();
        //模板赋值显示
        $this->assign('sendlist',$SendList);
        $this->assign("page", $page);
        $this->assign('totalCount', $count);//数据总数
        $this->assign('currentPage', !empty($_REQUEST[C('VAR_PAGE')]) ? $_REQUEST[C('VAR_PAGE')] : 1);//当前的页数，默认为1
        $this->assign('numPerPage', $numPerPage); //每页显示多少条
        $this->display();
    }
    /*接受短信*/
    public function accept()
    {
        $curre_user_id = $_SESSION['zs_admin']['userid'];
        if ($curre_user_id == 1) {
            $ShouList = M('shou_sms')->order('shou_id desc')->select();
        }else{
            $ShouList = M('shou_sms')->where(array('user_id'=>$curre_user_id))->order('shou_id desc')->select();
        }

        foreach ($ShouList as $key => $val) {
            $ShouList[$key]['user_name'] = M('user')->where(array('id'=>$val['user_id']))->getField('nickname');
        }
        $this->assign('shoulist',$ShouList);
        $this->display();
    }
    public function aa()
    {
       var_dump(1);
    }
}
?>